import bean.Person;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: zhangxupeng
 * @date:2019/5/10
 * @Email: zhangxupeng@bilibili.com
 **/
public class TestJoin {
    public static void main(String[] args) {
        List<Person> list = Arrays.asList(
                new Person("Dragon Blaze", 5),
                new Person("Angry Bird", 5),
                new Person("Candy Crush", 5)
        );

        //{Dragon Blaze, Angry Bird, Candy Crush}
        String result = list.stream().map(x -> x.getName())
                .collect(Collectors.joining(", ", "{", "}"));
        System.out.println(result);
    }

}
